<!DOCTYPE html>
<html lang=en>
<head>
  <meta charset="utf-8">
  
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no, minimal-ui">
  <meta name="renderer" content="webkit">
  <meta http-equiv="Cache-Control" content="no-transform" />
  <meta http-equiv="Cache-Control" content="no-siteapp" />
  <meta name="apple-mobile-web-app-capable" content="yes">
  <meta name="apple-mobile-web-app-status-bar-style" content="black">
  <meta name="format-detection" content="telephone=no,email=no,adress=no">
  <!-- Color theme for statusbar -->
  <meta name="theme-color" content="#000000" />
  <!-- 强制页面在当前窗口以独立页面显示,防止别人在框架里调用页面 -->
  <meta http-equiv="window-target" content="_top" />
  
  
  <title>yolov5+trt+deepstream | Hexo</title>
  <meta name="description" content="目录  介绍 环境 电脑上 jetson上 搭建yolov5的环境 克隆tensorrtx   安装测试deepstream（5.0） 安装ds-6.0 yolov5检测   在ds中调用csi or usb摄像头 插件配置 视频输入 camera videofile media stream 多路USB 多路CSI   视频处理 物体检测 物体跟踪 检测后的具体分类   视频输出 多路合并 sc">
<meta property="og:type" content="article">
<meta property="og:title" content="yolov5+trt+deepstream">
<meta property="og:url" content="https://gitee.com/yin-qiyu/myblog/2022/02/23/learn_jetson/2.%20yolov5+tensorrt+deepstream/index.html">
<meta property="og:site_name" content="Hexo">
<meta property="og:description" content="目录  介绍 环境 电脑上 jetson上 搭建yolov5的环境 克隆tensorrtx   安装测试deepstream（5.0） 安装ds-6.0 yolov5检测   在ds中调用csi or usb摄像头 插件配置 视频输入 camera videofile media stream 多路USB 多路CSI   视频处理 物体检测 物体跟踪 检测后的具体分类   视频输出 多路合并 sc">
<meta property="og:locale" content="en_US">
<meta property="og:image" content="https://yqypicbed.oss-cn-hangzhou.aliyuncs.com/typoraoss/image-20220227222344603.png">
<meta property="og:image" content="https://yqypicbed.oss-cn-hangzhou.aliyuncs.com/typoraoss/image-20220227222435137.png">
<meta property="og:image" content="https://yqypicbed.oss-cn-hangzhou.aliyuncs.com/typoraoss/image-20220227222508150.png">
<meta property="og:image" content="https://yqypicbed.oss-cn-hangzhou.aliyuncs.com/typoraoss/image-20220405204625542.png">
<meta property="og:image" content="https://yqypicbed.oss-cn-hangzhou.aliyuncs.com/typoraoss/image-20220310143041733.png">
<meta property="og:image" content="https://yqypicbed.oss-cn-hangzhou.aliyuncs.com/typoraoss/image-20220310143135601.png">
<meta property="og:image" content="https://yqypicbed.oss-cn-hangzhou.aliyuncs.com/typoraoss/image-20220302114638745.png">
<meta property="og:image" content="https://yqypicbed.oss-cn-hangzhou.aliyuncs.com/typoraoss/image-20220227180343701.png">
<meta property="og:image" content="https://yqypicbed.oss-cn-hangzhou.aliyuncs.com/typoraoss/C2A46195D3579CC5DBF107815D2DB515.jpg">
<meta property="og:image" content="https://yqypicbed.oss-cn-hangzhou.aliyuncs.com/typoraoss/image-20220309232709200.png">
<meta property="article:published_time" content="2022-02-23T13:43:09.579Z">
<meta property="article:modified_time" content="2023-07-13T15:33:48.354Z">
<meta property="article:author" content="John Doe">
<meta name="twitter:card" content="summary">
<meta name="twitter:image" content="https://yqypicbed.oss-cn-hangzhou.aliyuncs.com/typoraoss/image-20220227222344603.png">
  <!-- Canonical links -->
  <link rel="canonical" href="https://gitee.com/yin-qiyu/myblog/2022/02/23/learn_jetson/2.%20yolov5+tensorrt+deepstream/index.html">
  
    <link rel="alternate" href="/atom.xml" title="Hexo" type="application/atom+xml">
  
  
    <link rel="icon" href="/favicon.png" type="image/x-icon">
  
  
<link rel="stylesheet" href="/yin-qiyu/myblog/css/style.css">

  
  
  
  
<meta name="generator" content="Hexo 6.3.0"></head>


<body class="main-center" itemscope itemtype="http://schema.org/WebPage">
  <header class="header" itemscope itemtype="http://schema.org/WPHeader">
  <div class="slimContent">
    <div class="navbar-header">
      
      
      <div class="profile-block text-center">
        <a id="avatar" href="https://github.com/cofess" target="_blank">
          <img class="img-circle img-rotate" src="/yin-qiyu/myblog/images/avatar.jpg" width="200" height="200">
        </a>
        <h2 id="name" class="hidden-xs hidden-sm">昵称</h2>
        <h3 id="title" class="hidden-xs hidden-sm hidden-md">Web Developer &amp; Designer</h3>
        <small id="location" class="text-muted hidden-xs hidden-sm"><i class="icon icon-map-marker"></i> Shenzhen, China</small>
      </div>
      
      <div class="search" id="search-form-wrap">

    <form class="search-form sidebar-form">
        <div class="input-group">
            <input type="text" class="search-form-input form-control" placeholder="Search" />
            <span class="input-group-btn">
                <button type="submit" class="search-form-submit btn btn-flat" onclick="return false;"><i class="icon icon-search"></i></button>
            </span>
        </div>
    </form>
    <div class="ins-search">
  <div class="ins-search-mask"></div>
  <div class="ins-search-container">
    <div class="ins-input-wrapper">
      <input type="text" class="ins-search-input" placeholder="Type something..." x-webkit-speech />
      <button type="button" class="close ins-close ins-selectable" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
    </div>
    <div class="ins-section-wrapper">
      <div class="ins-section-container"></div>
    </div>
  </div>
</div>


</div>
      <button class="navbar-toggle collapsed" type="button" data-toggle="collapse" data-target="#main-navbar" aria-controls="main-navbar" aria-expanded="false">
        <span class="sr-only">Toggle navigation</span>
        <span class="icon-bar"></span>
        <span class="icon-bar"></span>
        <span class="icon-bar"></span>
      </button>
    </div>
    <nav id="main-navbar" class="collapse navbar-collapse" itemscope itemtype="http://schema.org/SiteNavigationElement" role="navigation">
      <ul class="nav navbar-nav main-nav ">
        
        
        <li class="menu-item menu-item-home">
          <a href="/yin-qiyu/myblog/.">
            
            <i class="icon icon-home-fill"></i>
            
            <span class="menu-title">Home</span>
          </a>
        </li>
        
        
        <li class="menu-item menu-item-archives">
          <a href="/yin-qiyu/myblog/archives">
            
            <i class="icon icon-archives-fill"></i>
            
            <span class="menu-title">Archives</span>
          </a>
        </li>
        
        
        <li class="menu-item menu-item-categories">
          <a href="/yin-qiyu/myblog/categories">
            
            <i class="icon icon-folder"></i>
            
            <span class="menu-title">Categories</span>
          </a>
        </li>
        
        
        <li class="menu-item menu-item-tags">
          <a href="/yin-qiyu/myblog/tags">
            
            <i class="icon icon-tags"></i>
            
            <span class="menu-title">Tags</span>
          </a>
        </li>
        
        
        <li class="menu-item menu-item-repository">
          <a href="/yin-qiyu/myblog/repository">
            
            <i class="icon icon-project"></i>
            
            <span class="menu-title">Repository</span>
          </a>
        </li>
        
        
        <li class="menu-item menu-item-books">
          <a href="/yin-qiyu/myblog/books">
            
            <i class="icon icon-book-fill"></i>
            
            <span class="menu-title">Books</span>
          </a>
        </li>
        
        
        <li class="menu-item menu-item-links">
          <a href="/yin-qiyu/myblog/links">
            
            <i class="icon icon-friendship"></i>
            
            <span class="menu-title">Links</span>
          </a>
        </li>
        
        
        <li class="menu-item menu-item-about">
          <a href="/yin-qiyu/myblog/about">
            
            <i class="icon icon-cup-fill"></i>
            
            <span class="menu-title">About</span>
          </a>
        </li>
        
      </ul>
      
	
    <ul class="social-links">
    	
        <li><a href="https://github.com/cofess" target="_blank" title="Github" data-toggle=tooltip data-placement=top><i class="icon icon-github"></i></a></li>
        
        <li><a href="http://weibo.com/cofess" target="_blank" title="Weibo" data-toggle=tooltip data-placement=top><i class="icon icon-weibo"></i></a></li>
        
        <li><a href="https://twitter.com/iwebued" target="_blank" title="Twitter" data-toggle=tooltip data-placement=top><i class="icon icon-twitter"></i></a></li>
        
        <li><a href="https://www.behance.net/cofess" target="_blank" title="Behance" data-toggle=tooltip data-placement=top><i class="icon icon-behance"></i></a></li>
        
        <li><a href="/yin-qiyu/myblog/atom.xml" target="_blank" title="Rss" data-toggle=tooltip data-placement=top><i class="icon icon-rss"></i></a></li>
        
    </ul>

    </nav>
  </div>
</header>

  
    <aside class="sidebar" itemscope itemtype="http://schema.org/WPSideBar">
  <div class="slimContent">
    
      <div class="widget">
    <h3 class="widget-title">Board</h3>
    <div class="widget-body">
        <div id="board">
            <div class="content">
                <p>欢迎交流与分享经验!</p>
            </div>
        </div>
    </div>
</div>

    
      

    
      

    
      
    
      
  <div class="widget">
    <h3 class="widget-title">Archive</h3>
    <div class="widget-body">
      <ul class="archive-list"><li class="archive-list-item"><a class="archive-list-link" href="/yin-qiyu/myblog/archives/2023/07/">July 2023</a><span class="archive-list-count">1</span></li><li class="archive-list-item"><a class="archive-list-link" href="/yin-qiyu/myblog/archives/2023/04/">April 2023</a><span class="archive-list-count">1</span></li><li class="archive-list-item"><a class="archive-list-link" href="/yin-qiyu/myblog/archives/2023/03/">March 2023</a><span class="archive-list-count">1</span></li><li class="archive-list-item"><a class="archive-list-link" href="/yin-qiyu/myblog/archives/2023/02/">February 2023</a><span class="archive-list-count">2</span></li><li class="archive-list-item"><a class="archive-list-link" href="/yin-qiyu/myblog/archives/2023/01/">January 2023</a><span class="archive-list-count">5</span></li><li class="archive-list-item"><a class="archive-list-link" href="/yin-qiyu/myblog/archives/2022/04/">April 2022</a><span class="archive-list-count">1</span></li><li class="archive-list-item"><a class="archive-list-link" href="/yin-qiyu/myblog/archives/2022/03/">March 2022</a><span class="archive-list-count">1</span></li><li class="archive-list-item"><a class="archive-list-link" href="/yin-qiyu/myblog/archives/2022/02/">February 2022</a><span class="archive-list-count">7</span></li></ul>
    </div>
  </div>


    
      
  <div class="widget">
    <h3 class="widget-title">Recent Posts</h3>
    <div class="widget-body">
      <ul class="recent-post-list list-unstyled no-thumbnail">
        
          <li>
            
            <div class="item-inner">
              <p class="item-category">
                
              </p>
              <p class="item-title">
                <a href="/yin-qiyu/myblog/2023/07/13/hello-world/" class="title">Hello World</a>
              </p>
              <p class="item-date">
                <time datetime="2023-07-13T14:49:10.957Z" itemprop="datePublished">2023-07-13</time>
              </p>
            </div>
          </li>
          
          <li>
            
            <div class="item-inner">
              <p class="item-category">
                
              </p>
              <p class="item-title">
                <a href="/yin-qiyu/myblog/2023/04/04/FreeRTOS/lonely_binary/" class="title">(no title)</a>
              </p>
              <p class="item-date">
                <time datetime="2023-04-04T06:56:35.461Z" itemprop="datePublished">2023-04-04</time>
              </p>
            </div>
          </li>
          
          <li>
            
            <div class="item-inner">
              <p class="item-category">
                
              </p>
              <p class="item-title">
                <a href="/yin-qiyu/myblog/2023/03/16/esp/esp-idf/issue/" class="title">(no title)</a>
              </p>
              <p class="item-date">
                <time datetime="2023-03-16T06:02:58.279Z" itemprop="datePublished">2023-03-16</time>
              </p>
            </div>
          </li>
          
          <li>
            
            <div class="item-inner">
              <p class="item-category">
                
              </p>
              <p class="item-title">
                <a href="/yin-qiyu/myblog/2023/02/26/%E5%A2%A8%E6%B0%B4%E5%B1%8F/Untitled/" class="title">(no title)</a>
              </p>
              <p class="item-date">
                <time datetime="2023-02-25T17:10:25.099Z" itemprop="datePublished">2023-02-26</time>
              </p>
            </div>
          </li>
          
          <li>
            
            <div class="item-inner">
              <p class="item-category">
                
              </p>
              <p class="item-title">
                <a href="/yin-qiyu/myblog/2023/02/02/%E5%A2%A8%E6%B0%B4%E5%B1%8F/epaper/" class="title">(no title)</a>
              </p>
              <p class="item-date">
                <time datetime="2023-02-02T05:54:50.611Z" itemprop="datePublished">2023-02-02</time>
              </p>
            </div>
          </li>
          
      </ul>
    </div>
  </div>
  

    
  </div>
</aside>

  
  
<main class="main" role="main">
  <div class="content">
  <article id="post-learn_jetson/2. yolov5+tensorrt+deepstream" class="article article-type-post" itemscope itemtype="http://schema.org/BlogPosting">
    
    <div class="article-header">
      
        
  
    <h1 class="article-title" itemprop="name">
      yolov5+trt+deepstream
    </h1>
  

      
      <div class="article-meta">
        <span class="article-date">
    <i class="icon icon-calendar-check"></i>
	<a href="/yin-qiyu/myblog/2022/02/23/learn_jetson/2.%20yolov5+tensorrt+deepstream/" class="article-date">
	  <time datetime="2022-02-23T13:43:09.579Z" itemprop="datePublished">2022-02-23</time>
	</a>
</span>
        
        

        

        <span class="post-comment"><i class="icon icon-comment"></i> <a href="/yin-qiyu/myblog/2022/02/23/learn_jetson/2.%20yolov5+tensorrt+deepstream/#comments" class="article-comment-link">Comments</a></span>
        
      </div>
    </div>
    <div class="article-entry marked-body" itemprop="articleBody">
      
        <p>目录</p>
<ul>
<li><a href="#%E4%BB%8B%E7%BB%8D">介绍</a></li>
<li><a href="#%E7%8E%AF%E5%A2%83">环境</a></li>
<li><a href="#%E7%94%B5%E8%84%91%E4%B8%8A">电脑上</a></li>
<li><a href="#jetson%E4%B8%8A">jetson上</a><ul>
<li><a href="#%E6%90%AD%E5%BB%BAyolov5%E7%9A%84%E7%8E%AF%E5%A2%83">搭建yolov5的环境</a></li>
<li><a href="#%E5%85%8B%E9%9A%86tensorrtx">克隆tensorrtx</a></li>
</ul>
</li>
<li><a href="#%E5%AE%89%E8%A3%85%E6%B5%8B%E8%AF%95deepstream50">安装测试deepstream（5.0）</a><ul>
<li><a href="#%E5%AE%89%E8%A3%85ds-60">安装ds-6.0</a></li>
<li><a href="#yolov5%E6%A3%80%E6%B5%8B">yolov5检测</a></li>
</ul>
</li>
<li><a href="#%E5%9C%A8ds%E4%B8%AD%E8%B0%83%E7%94%A8csi-or-usb%E6%91%84%E5%83%8F%E5%A4%B4">在ds中调用csi or usb摄像头</a></li>
<li><a href="#%E6%8F%92%E4%BB%B6%E9%85%8D%E7%BD%AE">插件配置</a><ul>
<li><a href="#%E8%A7%86%E9%A2%91%E8%BE%93%E5%85%A5">视频输入</a><ul>
<li><a href="#camera">camera</a></li>
<li><a href="#videofile">videofile</a></li>
<li><a href="#media-stream">media stream</a></li>
<li><a href="#%E5%A4%9A%E8%B7%AFusb">多路USB</a></li>
<li><a href="#%E5%A4%9A%E8%B7%AFcsi">多路CSI</a></li>
</ul>
</li>
<li><a href="#%E8%A7%86%E9%A2%91%E5%A4%84%E7%90%86">视频处理</a><ul>
<li><a href="#%E7%89%A9%E4%BD%93%E6%A3%80%E6%B5%8B">物体检测</a></li>
<li><a href="#%E7%89%A9%E4%BD%93%E8%B7%9F%E8%B8%AA">物体跟踪</a></li>
<li><a href="#%E6%A3%80%E6%B5%8B%E5%90%8E%E7%9A%84%E5%85%B7%E4%BD%93%E5%88%86%E7%B1%BB">检测后的具体分类</a></li>
</ul>
</li>
<li><a href="#%E8%A7%86%E9%A2%91%E8%BE%93%E5%87%BA">视频输出</a><ul>
<li><a href="#%E5%A4%9A%E8%B7%AF%E5%90%88%E5%B9%B6">多路合并</a></li>
<li><a href="#screen">screen</a></li>
<li><a href="#videofile-1">videofile</a></li>
<li><a href="#media-stream-1">media stream</a></li>
<li><a href="#osd">osd</a></li>
<li><a href="#streammux">streammux</a></li>
</ul>
</li>
<li><a href="#sample%E4%BE%8B%E7%A8%8B">Sample例程</a></li>
</ul>
</li>
<li><a href="#%E9%83%A8%E7%BD%B2%E8%87%AA%E5%B7%B1%E7%9A%84%E6%A8%A1%E5%9E%8B">部署自己的模型</a></li>
<li><a href="#references">References</a><ul>
<li><a href="#%E9%83%A8%E7%BD%B2">部署</a></li>
<li><a href="#deepstream">deepstream</a></li>
</ul>
</li>
</ul>
<h1 id="介绍"><a href="#介绍" class="headerlink" title="介绍"></a>介绍</h1><p>在主机上训练自己的Yolov5模型，转为TensorRT模型并部署到Jetson Nano上，用DeepStream运行。（先以yolov5s.pt为例）</p>
<h1 id="环境"><a href="#环境" class="headerlink" title="环境"></a>环境</h1><p>硬件环境：</p>
<ul>
<li><p>带cuda的显卡主机</p>
</li>
<li><p>Jetson Nano 4G B01</p>
</li>
<li><p>csi摄像头、usb摄像头</p>
</li>
</ul>
<p>软件环境：</p>
<ul>
<li>yolov5-5.0</li>
<li>jetpack-4.4</li>
<li>deepstream-5.0</li>
<li>Tensorrt-7.1</li>
<li>Cuda-10.2</li>
</ul>
<img src="https://yqypicbed.oss-cn-hangzhou.aliyuncs.com/typoraoss/image-20220227222344603.png" alt="image-20220227222344603" width="500" />

<img src="https://yqypicbed.oss-cn-hangzhou.aliyuncs.com/typoraoss/image-20220227222435137.png" alt="image-20220227222435137" width="500" />

<img src="https://yqypicbed.oss-cn-hangzhou.aliyuncs.com/typoraoss/image-20220227222508150.png" alt="image-20220227222508150" width="500" />





<h1 id="电脑上"><a href="#电脑上" class="headerlink" title="电脑上"></a>电脑上</h1><ul>
<li>下载yolov5</li>
</ul>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">$ git <span class="built_in">clone</span> -b v5.0 https://github.com/ultralytics/yolov5.git</span><br><span class="line">$ git <span class="built_in">clone</span> -b yolov5-v5.0 https://github.com/wang-xinyu/tensorrtx.git</span><br></pre></td></tr></table></figure>

<p>官方教程文档：</p>
<p><a target="_blank" rel="noopener" href="https://github.com/wang-xinyu/tensorrtx/tree/yolov5-v5.0/yolov5">tensorrtx&#x2F;yolov5 at yolov5-v5.0 · wang-xinyu&#x2F;tensorrtx (github.com)</a></p>
<ul>
<li>若电脑上无法转engine在jetson也可以操作</li>
</ul>
<h1 id="jetson上"><a href="#jetson上" class="headerlink" title="jetson上"></a>jetson上</h1><h2 id="搭建yolov5的环境"><a href="#搭建yolov5的环境" class="headerlink" title="搭建yolov5的环境"></a>搭建yolov5的环境</h2><p>git clone <a target="_blank" rel="noopener" href="https://github.com/ultralytics/yolov5.git">https://github.com/ultralytics/yolov5.git</a></p>
<p>python3 -m pip install –upgrade pip</p>
<p>进入yolov5的项目里</p>
<p>pip3 install -r requirements</p>
<p>若出现pillow相关报错：pillow需要pip3 uninstall重新pip3 install pillow</p>
<h2 id="克隆tensorrtx"><a href="#克隆tensorrtx" class="headerlink" title="克隆tensorrtx"></a>克隆tensorrtx</h2><p>仓库： <a target="_blank" rel="noopener" href="https://github.com/wang-xinyu/tensorrtx.git">https://github.com/wang-xinyu/tensorrtx.git</a></p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">git <span class="built_in">clone</span> https://github.com/wang-xinyu/tensorrtx.git</span><br></pre></td></tr></table></figure>

<p>将生成的.wts放到tensorrtx&#x2F;yolov5&#x2F;下</p>
<p>若是自己训练的模型需修改<code>tensorrtx/yolov5/yololayer.h</code></p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">static constexpr int CLASS_NUM = 80</span><br></pre></td></tr></table></figure>

<p>编译代码</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br></pre></td><td class="code"><pre><span class="line"><span class="built_in">cd</span> &#123;tensorrtx&#125;/yolov5/</span><br><span class="line"><span class="built_in">mkdir</span> build</span><br><span class="line"><span class="built_in">cd</span> build</span><br><span class="line"><span class="built_in">cp</span> &#123;ultralytics&#125;/yolov5/yolov5s.wts &#123;tensorrtx&#125;/yolov5/build</span><br><span class="line">cmake ..</span><br><span class="line">make</span><br></pre></td></tr></table></figure>

<p>将生成的.wts文件转为.engine文件</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">sudo ./yolov5 -s yolov5s.wts yolov5s.engine s</span><br></pre></td></tr></table></figure>

<img src="https://yqypicbed.oss-cn-hangzhou.aliyuncs.com/typoraoss/image-20220405204625542.png" alt="image-20220405204625542" width="500" />

<p>将要测试的图片放到tensorrtx&#x2F;yolov5&#x2F;samples&#x2F;下，测试能否检测目标</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">sudo ./yolov5 -d ../best.engine ../samples</span><br></pre></td></tr></table></figure>

<p>经过测试转成tensorrt后推理速度大幅加快</p>
<p>图片大小：640*640</p>
<ul>
<li>Yolov5.s推理速度在130ms左右</li>
</ul>
<img src="https://yqypicbed.oss-cn-hangzhou.aliyuncs.com/typoraoss/image-20220310143041733.png" alt="image-20220310143041733" width="500"  />

<ul>
<li>转换成tensorrt后的推理速度在70ms左右</li>
</ul>
<img src="https://yqypicbed.oss-cn-hangzhou.aliyuncs.com/typoraoss/image-20220310143135601.png" alt="image-20220310143135601" width="500" />

<h1 id="安装测试deepstream（5-0）"><a href="#安装测试deepstream（5-0）" class="headerlink" title="安装测试deepstream（5.0）"></a>安装测试deepstream（5.0）</h1><p>:bangbang:<strong>一定要在官方文档中查看deepstream和jetpack相对应的版本，如Jetpack 4.6 support Deepstream 6.0</strong></p>
<img src="https://yqypicbed.oss-cn-hangzhou.aliyuncs.com/typoraoss/image-20220302114638745.png" alt="image-20220302114638745"  width="500" />

<p>官方文档：<a target="_blank" rel="noopener" href="https://docs.nvidia.com/metropolis/#page/DeepStream_Plugin_Manual/deepstream_plugin_faq.html%23wwpID0EGHA">NVIDIA Metropolis Documentation</a></p>
<p>官网下载：<a target="_blank" rel="noopener" href="https://developer.nvidia.com/deepstream-getting-started">DeepStream Getting Started | NVIDIA Developer</a></p>
<p>老版本：<a target="_blank" rel="noopener" href="https://developer.nvidia.com/embedded/deepstream-on-jetson-downloads-archived">NVIDIA DeepStream SDK on Jetson (Archived) | NVIDIA Developer</a></p>
<ul>
<li>精简版笔记</li>
</ul>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br></pre></td><td class="code"><pre><span class="line">$ sudo apt install \</span><br><span class="line">    libssl1.0.0 \</span><br><span class="line">    libgstreamer1.0-0 \</span><br><span class="line">    gstreamer1.0-tools \</span><br><span class="line">    gstreamer1.0-plugins-good \</span><br><span class="line">    gstreamer1.0-plugins-bad \</span><br><span class="line">    gstreamer1.0-plugins-ugly \</span><br><span class="line">    gstreamer1.0-libav \</span><br><span class="line">    libgstrtspserver-1.0-0 \</span><br><span class="line">    libjansson4=2.11-1</span><br><span class="line">$ sudo apt-get install librdkafka1=0.11.3-1build1</span><br><span class="line">$ tar -xpvf deepstream_sdk_v4.0.2_jetson.tbz2</span><br><span class="line">$ <span class="built_in">cd</span> deepstream_sdk_v4.0.2_jetson</span><br><span class="line">$ sudo tar -xvpf binaries.tbz2 -C /</span><br><span class="line">$ sudo ./install.sh</span><br><span class="line">$ sudo ldconfig</span><br></pre></td></tr></table></figure>



<ul>
<li>详细版</li>
</ul>
<ol>
<li>安装测试ds(官方release有详细文档)</li>
</ol>
<p>安装软件包</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br></pre></td><td class="code"><pre><span class="line">sudo apt install \</span><br><span class="line">libssl1.0.0 \</span><br><span class="line">libgstreamer1.0-0 \</span><br><span class="line">gstreamer1.0-tools \</span><br><span class="line">gstreamer1.0-plugins-good \</span><br><span class="line">gstreamer1.0-plugins-bad \</span><br><span class="line">gstreamer1.0-plugins-ugly \</span><br><span class="line">gstreamer1.0-libav \</span><br><span class="line">libgstrtspserver-1.0-0 \</span><br><span class="line">libjansson4=2.11-1</span><br></pre></td></tr></table></figure>

<ol start="2">
<li><p>下载sdk放入jetson</p>
</li>
<li><p>提取解压sdk</p>
</li>
</ol>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line">sudo tar -xvf deepstream_sdk_v5.1.0_jetson.tbz2 -C /</span><br><span class="line"><span class="built_in">cd</span> /opt/nvidia/deepstream/deepstream-5.1</span><br><span class="line">sudo ./install.sh</span><br><span class="line">sudo ldconfig</span><br></pre></td></tr></table></figure>

<ol start="4">
<li>安装完成后测试</li>
</ol>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line"><span class="built_in">cd</span> /opt/nvidia/deepstream/deepstream-5.0/samples/configs/deepstream-app/</span><br></pre></td></tr></table></figure>

<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">deepstream-app -c source8_1080p_dec_infer-resnet_tracker_tiled_display_fp16_nano.txt</span><br></pre></td></tr></table></figure>





<h2 id="安装ds-6-0"><a href="#安装ds-6-0" class="headerlink" title="安装ds-6.0"></a>安装ds-6.0</h2><p><a target="_blank" rel="noopener" href="https://docs.nvidia.com/metropolis/deepstream/dev-guide/text/DS_Quickstart.html#jetson-setup">Quickstart Guide — DeepStream 6.0 Release documentation (nvidia.com)</a></p>
<p><a target="_blank" rel="noopener" href="https://github.com/rscgg37248/DeepStream6.0_Yolov5-6.0">rscgg37248&#x2F;DeepStream6.0_Yolov5-6.0: 基于DeepStream6.0和yolov5-6.0的目标检测 (github.com)</a></p>
<ul>
<li>Install</li>
</ul>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br></pre></td><td class="code"><pre><span class="line">$ sudo apt install \</span><br><span class="line">libssl1.0.0 \</span><br><span class="line">libgstreamer1.0-0 \</span><br><span class="line">gstreamer1.0-tools \</span><br><span class="line">gstreamer1.0-plugins-good \</span><br><span class="line">gstreamer1.0-plugins-bad \</span><br><span class="line">gstreamer1.0-plugins-ugly \</span><br><span class="line">gstreamer1.0-libav \</span><br><span class="line">libgstrtspserver-1.0-0 \</span><br><span class="line">libjansson4=2.11-1</span><br><span class="line"></span><br><span class="line">$ sudo tar -xvf deepstream_sdk_v6.0.0_jetson.tbz2 -C /</span><br><span class="line">$ <span class="built_in">cd</span> /opt/nvidia/deepstream/deepstream-6.0</span><br><span class="line">$ sudo ./install.sh</span><br><span class="line">$ sudo ldconfig</span><br></pre></td></tr></table></figure>

<ul>
<li>Test</li>
</ul>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line">$ <span class="built_in">cd</span> /opt/nvidia/deepstream/deepstream-6.0/samples/configs/deepstream-app/</span><br><span class="line"></span><br><span class="line">$ deepstream-app -c source8_1080p_dec_infer-resnet_tracker_tiled_display_fp16_nano.txt</span><br></pre></td></tr></table></figure>





<h2 id="yolov5检测"><a href="#yolov5检测" class="headerlink" title="yolov5检测"></a>yolov5检测</h2><p>:bangbang:<strong>Jetson nano的系统版本是4.5.1 TensorRT版本7.x yolov5版本 5.0 pillow需要pip3 uninstall重新pip3 install pillow</strong></p>
<p>安装完ds后在&#x2F;opt&#x2F;nvidia&#x2F;deepstream&#x2F;deepstream-5.0&#x2F;sources&#x2F;objectDetector_Yolo会有一个部署yolo的官方实例代码，但只有yolov3的。</p>
<p>github上有已经改好yolov5的项目：<a target="_blank" rel="noopener" href="https://github.com/DanaHan/Yolov5-in-Deepstream-5.0">DanaHan&#x2F;Yolov5-in-Deepstream-5.0: Describe how to use yolov5 in Deepstream 5.0 (github.com)</a></p>
<p>我使用的tensorrt7的版本在里面有适配的分支：<a target="_blank" rel="noopener" href="https://github.com/Abandon-ht/Yolov5-in-Deepstream-5.0/tree/tensorrt7">Abandon-ht&#x2F;Yolov5-in-Deepstream-5.0 at tensorrt7 (github.com)</a></p>
<p>克隆项目</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">git <span class="built_in">clone</span> https://github.com/DanaHan/Yolov5-in-Deepstream-5.0.git</span><br></pre></td></tr></table></figure>

<p>测试</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br></pre></td><td class="code"><pre><span class="line"><span class="built_in">cd</span> Yolov5-in-Deepstream-5.0/Deepstream 5.0</span><br><span class="line"></span><br><span class="line"><span class="comment">#复制coco数据集的labels</span></span><br><span class="line"><span class="built_in">cp</span> ~/darknet/data/coco.names ./labels.txt</span><br><span class="line"></span><br><span class="line"><span class="comment">#复制之前生成的引擎文件到当前目录</span></span><br><span class="line"><span class="built_in">cp</span> ~/tensorrtx/yolov5/build/yolov5s.engine ./</span><br><span class="line"></span><br><span class="line"><span class="built_in">cd</span> nvdsinfer_custom_impl_Yolo</span><br><span class="line"></span><br><span class="line"><span class="comment"># 生成libnvdsinfer_custom_impl_Yolo.so文件</span></span><br><span class="line">make -j</span><br><span class="line"></span><br><span class="line"><span class="comment">#返回到DeepStream5.0/下</span></span><br><span class="line"><span class="built_in">cd</span> ..</span><br><span class="line"></span><br><span class="line"><span class="comment">#测试</span></span><br><span class="line">LD_PRELOAD=./libmyplugins.so deepstream-app -c deepstream_app_config_yoloV5.txt</span><br></pre></td></tr></table></figure>

<img src="https://yqypicbed.oss-cn-hangzhou.aliyuncs.com/typoraoss/image-20220227180343701.png" alt="image-20220227180343701" style="zoom: 25%;" />

<h1 id="在ds中调用csi-or-usb摄像头"><a href="#在ds中调用csi-or-usb摄像头" class="headerlink" title="在ds中调用csi or usb摄像头"></a>在ds中调用csi or usb摄像头</h1><p>参考资料<a target="_blank" rel="noopener" href="http://www.elecfans.com/d/1677110.html">如何在deepstream-app里调用USB与CSI摄像头-电子发烧友网 (elecfans.com)</a></p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">#安装v4l-utils</span></span><br><span class="line">apt-get install v4l-utils</span><br><span class="line"></span><br><span class="line"><span class="comment">#查看摄像头信息</span></span><br><span class="line">v4l2-ctl --list-devices</span><br></pre></td></tr></table></figure>



<p>查看摄像头可用分辨率</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">v4l2-ctl --list-formats-ext --device=0</span><br><span class="line">v4l2-ctl --list-formats-ext --device=1</span><br></pre></td></tr></table></figure>



<p>修改deepstream_app_config_yoloV5.txt的source</p>
<p>我个人使用的是罗技的<code>c920</code>摄像头（usb）</p>
<p>参数如下</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br></pre></td><td class="code"><pre><span class="line">[source0]</span><br><span class="line"><span class="built_in">enable</span>=1</span><br><span class="line"><span class="comment">#Type - 1=CameraV4L2 2=URI 3=MultiURI</span></span><br><span class="line"><span class="built_in">type</span>=1</span><br><span class="line">camera-width=1280</span><br><span class="line">camera-height=720</span><br><span class="line">camera-fps-n=30</span><br><span class="line">camera-v4l2-dev-node=0</span><br><span class="line"><span class="comment">#uri=file://../../samples/streams/sample_1080p_h264.mp4</span></span><br><span class="line">num-sources=1</span><br><span class="line">gpu-id=0</span><br><span class="line"><span class="comment"># (0): memtype_device   - Memory type Device</span></span><br><span class="line"><span class="comment"># (1): memtype_pinned   - Memory type Host Pinned</span></span><br><span class="line"><span class="comment"># (2): memtype_unified  - Memory type Unified</span></span><br><span class="line">cudadec-memtype=0</span><br></pre></td></tr></table></figure>

<img src="https://yqypicbed.oss-cn-hangzhou.aliyuncs.com/typoraoss/C2A46195D3579CC5DBF107815D2DB515.jpg" alt="C2A46195D3579CC5DBF107815D2DB515" style="zoom:25%;" />





<h1 id="插件配置"><a href="#插件配置" class="headerlink" title="插件配置"></a>插件配置</h1><p>参考deepstream_sdk_v4.0.2_jetson&#x2F;samples&#x2F;configs&#x2F;deepstream-app&#x2F;下的配置文件:</p>
<ul>
<li><p>source30_1080p_resnet_dec_infer_tiled_display_int8.txt：演示具有主要推理功能的30个流解码。（仅适用于dGPU和Jetson AGX Xavier平台。）</p>
</li>
<li><p>source4_1080p_resnet_dec_infer_tiled_display_int8.txt：演示具有主要推理，对象跟踪和三个不同辅助分类器的四个流解码。（仅适用于dGPU和Jetson AGX Xavier平台。）</p>
</li>
<li><p>source4_1080p_resnet_dec_infer_tracker_sgie_tiled_display_int8_gpu1.txt：在GPU 1上针对主要推理，对象跟踪和三个不同的二级分类器演示四个流解码（对于具有多个GPU卡的系统）。仅适用于dGPU平台。</p>
</li>
<li><p>config_infer_primary.txt：将 nvinfer元素配置为主要检测器。</p>
</li>
<li><p>config_infer_secondary_carcolor.txt， config_infer_secondary_carmake.txt， config_infer_secondary_vehicletypes.txt：将 nvinfer元素配置为辅助分类器。</p>
</li>
<li><p>iou_config.txt：配置一个低级的IOU（联合路口）跟踪器。</p>
</li>
<li><p>source1_usb_dec_infer_resnet_int8.txt：演示一台USB摄像机作为输入。</p>
</li>
<li><p>source1_csi_dec_infer_resnet_int8.txt：演示一个CSI摄像机作为输入；仅限于Jetson。</p>
</li>
<li><p>source2_csi_usb_dec_infer_resnet_int8.txt：演示一台CSI摄像机和一台USB摄像机作为输入；仅限于Jetson。</p>
</li>
<li><p>source6_csi_dec_infer_resnet_int8.txt：演示六个CSI摄像机作为输入；仅限于Jetson。</p>
</li>
<li><p>source8_1080p_dec_infer-resnet_tracker_tiled_display_fp16_nano.txt：演示8解码+推断+跟踪器；仅适用于Jetson Nano。</p>
</li>
<li><p>source8_1080p_dec_infer-resnet_tracker_tiled_display_fp16_tx1.txt：演示8解码+推断+跟踪器；仅适用于Jetson TX1。</p>
</li>
<li><p>source12_1080p_dec_infer-resnet_tracker_tiled_display_fp16_tx2.txt：演示12个解码+推断+跟踪器；仅适用于Jetson TX2。</p>
</li>
</ul>
<h2 id="视频输入"><a href="#视频输入" class="headerlink" title="视频输入"></a>视频输入</h2><ul>
<li>默认测试视频</li>
</ul>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br><span class="line">46</span><br><span class="line">47</span><br><span class="line">48</span><br><span class="line">49</span><br><span class="line">50</span><br><span class="line">51</span><br><span class="line">52</span><br><span class="line">53</span><br><span class="line">54</span><br><span class="line">55</span><br><span class="line">56</span><br><span class="line">57</span><br><span class="line">58</span><br><span class="line">59</span><br><span class="line">60</span><br><span class="line">61</span><br><span class="line">62</span><br><span class="line">63</span><br><span class="line">64</span><br><span class="line">65</span><br><span class="line">66</span><br><span class="line">67</span><br><span class="line">68</span><br><span class="line">69</span><br><span class="line">70</span><br><span class="line">71</span><br><span class="line">72</span><br><span class="line">73</span><br><span class="line">74</span><br><span class="line">75</span><br><span class="line">76</span><br><span class="line">77</span><br><span class="line">78</span><br><span class="line">79</span><br><span class="line">80</span><br><span class="line">81</span><br><span class="line">82</span><br><span class="line">83</span><br><span class="line">84</span><br><span class="line">85</span><br><span class="line">86</span><br><span class="line">87</span><br><span class="line">88</span><br><span class="line">89</span><br><span class="line">90</span><br><span class="line">91</span><br><span class="line">92</span><br><span class="line">93</span><br><span class="line">94</span><br><span class="line">95</span><br><span class="line">96</span><br><span class="line">97</span><br><span class="line">98</span><br><span class="line">99</span><br><span class="line">100</span><br><span class="line">101</span><br><span class="line">102</span><br><span class="line">103</span><br><span class="line">104</span><br><span class="line">105</span><br></pre></td><td class="code"><pre><span class="line">[application]</span><br><span class="line">enable-perf-measurement=1</span><br><span class="line">perf-measurement-interval-sec=5</span><br><span class="line"><span class="comment">#gie-kitti-output-dir=streamscl</span></span><br><span class="line"></span><br><span class="line">[tiled-display]</span><br><span class="line"><span class="built_in">enable</span>=0</span><br><span class="line">rows=1</span><br><span class="line">columns=1</span><br><span class="line">width=1280</span><br><span class="line">height=720</span><br><span class="line">gpu-id=0</span><br><span class="line"><span class="comment">#(0): nvbuf-mem-default - Default memory allocated, specific to particular platform</span></span><br><span class="line"><span class="comment">#(1): nvbuf-mem-cuda-pinned - Allocate Pinned/Host cuda memory, applicable for Tesla</span></span><br><span class="line"><span class="comment">#(2): nvbuf-mem-cuda-device - Allocate Device cuda memory, applicable for Tesla</span></span><br><span class="line"><span class="comment">#(3): nvbuf-mem-cuda-unified - Allocate Unified cuda memory, applicable for Tesla</span></span><br><span class="line"><span class="comment">#(4): nvbuf-mem-surface-array - Allocate Surface Array memory, applicable for Jetson</span></span><br><span class="line">nvbuf-memory-type=0</span><br><span class="line"></span><br><span class="line">[source0]</span><br><span class="line"><span class="built_in">enable</span>=1</span><br><span class="line"><span class="comment">#Type - 1=CameraV4L2 2=URI 3=MultiURI</span></span><br><span class="line"><span class="built_in">type</span>=2</span><br><span class="line">uri=file:/opt/nvidia/deepstream/deepstream-6.0/samples/streams/sample_1080p_h264.mp4</span><br><span class="line"><span class="comment">#uri=file:/home/nvidia/Documents/5-Materials/Videos/0825.avi</span></span><br><span class="line">num-sources=1</span><br><span class="line">gpu-id=0</span><br><span class="line"><span class="comment"># (0): memtype_device   - Memory type Device</span></span><br><span class="line"><span class="comment"># (1): memtype_pinned   - Memory type Host Pinned</span></span><br><span class="line"><span class="comment"># (2): memtype_unified  - Memory type Unified</span></span><br><span class="line">cudadec-memtype=0</span><br><span class="line"></span><br><span class="line"></span><br><span class="line">[sink0]</span><br><span class="line"><span class="built_in">enable</span>=1</span><br><span class="line"><span class="comment">#Type - 1=FakeSink 2=EglSink 3=File</span></span><br><span class="line"><span class="built_in">type</span>=2</span><br><span class="line"><span class="built_in">sync</span>=0</span><br><span class="line">source-id=0</span><br><span class="line">gpu-id=0</span><br><span class="line">nvbuf-memory-type=0</span><br><span class="line"><span class="comment">#1=mp4 2=mkv</span></span><br><span class="line">container=1</span><br><span class="line"><span class="comment">#1=h264 2=h265</span></span><br><span class="line">codec=1</span><br><span class="line">output-file=yolov4.mp4</span><br><span class="line"></span><br><span class="line">[osd]</span><br><span class="line"><span class="built_in">enable</span>=1</span><br><span class="line">gpu-id=0</span><br><span class="line">border-width=1</span><br><span class="line">text-size=12</span><br><span class="line">text-color=1;1;1;1;</span><br><span class="line">text-bg-color=0.3;0.3;0.3;1</span><br><span class="line">font=Serif</span><br><span class="line">show-clock=0</span><br><span class="line">clock-x-offset=800</span><br><span class="line">clock-y-offset=820</span><br><span class="line">clock-text-size=12</span><br><span class="line">clock-color=1;0;0;0</span><br><span class="line">nvbuf-memory-type=0</span><br><span class="line"></span><br><span class="line">[streammux]</span><br><span class="line">gpu-id=0</span><br><span class="line"><span class="comment">##Boolean property to inform muxer that sources are live</span></span><br><span class="line">live-source=0</span><br><span class="line">batch-size=4</span><br><span class="line"><span class="comment">##time out in usec, to wait after the first buffer is available</span></span><br><span class="line"><span class="comment">##to push the batch even if the complete batch is not formed</span></span><br><span class="line">batched-push-timeout=40000</span><br><span class="line"><span class="comment">## Set muxer output width and height</span></span><br><span class="line">width=1280</span><br><span class="line">height=720</span><br><span class="line"><span class="comment">##Enable to maintain aspect ratio wrt source, and allow black borders, works</span></span><br><span class="line"><span class="comment">##along with width, height properties</span></span><br><span class="line">enable-padding=0</span><br><span class="line">nvbuf-memory-type=0</span><br><span class="line"></span><br><span class="line"><span class="comment"># config-file property is mandatory for any gie section.</span></span><br><span class="line"><span class="comment"># Other properties are optional and if set will override the properties set in</span></span><br><span class="line"><span class="comment"># the infer config file.</span></span><br><span class="line">[primary-gie]</span><br><span class="line"><span class="built_in">enable</span>=1</span><br><span class="line">gpu-id=0</span><br><span class="line">model-engine-file=yolov5s.engine</span><br><span class="line">labelfile-path=labels.txt</span><br><span class="line"><span class="comment">#batch-size=1</span></span><br><span class="line"><span class="comment">#Required by the app for OSD, not a plugin property</span></span><br><span class="line">bbox-border-color0=1;0;0;1</span><br><span class="line">bbox-border-color1=0;1;1;1</span><br><span class="line">bbox-border-color2=0;0;1;1</span><br><span class="line">bbox-border-color3=0;1;0;1</span><br><span class="line">interval=0</span><br><span class="line">gie-unique-id=1</span><br><span class="line">nvbuf-memory-type=0</span><br><span class="line">config-file=config_infer_primary_yoloV5.txt</span><br><span class="line"></span><br><span class="line">[tracker]</span><br><span class="line"><span class="built_in">enable</span>=0</span><br><span class="line">tracker-width=512</span><br><span class="line">tracker-height=320</span><br><span class="line">ll-lib-file=/opt/nvidia/deepstream/deepstream-5.0/lib/libnvds_mot_klt.so</span><br><span class="line"></span><br><span class="line">[tests]</span><br><span class="line">file-loop=0</span><br></pre></td></tr></table></figure>



<h4 id="camera"><a href="#camera" class="headerlink" title="camera"></a>camera</h4><ul>
<li>USB摄像头</li>
</ul>
<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br></pre></td><td class="code"><pre><span class="line">[source0]</span><br><span class="line">enable=1</span><br><span class="line">#Type - 1=CameraV4L2 2=URI 3=MultiURI</span><br><span class="line">type=1</span><br><span class="line">camera-width=1280</span><br><span class="line">camera-height=720</span><br><span class="line">camera-fps-n=30</span><br><span class="line">camera-fps-d=1</span><br><span class="line">camera-v4l2-dev-node=0</span><br></pre></td></tr></table></figure>

<ul>
<li>CSI摄像头</li>
</ul>
<img src="https://yqypicbed.oss-cn-hangzhou.aliyuncs.com/typoraoss/image-20220309232709200.png" alt="image-20220309232709200" style="zoom:50%;" />

<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br></pre></td><td class="code"><pre><span class="line">[source0]</span><br><span class="line">enable=1</span><br><span class="line">#Type - 1=CameraV4L2 2=URI 3=MultiURI 4=RTSP 5=CSI</span><br><span class="line">type=5</span><br><span class="line">camera-width=1280</span><br><span class="line">camera-height=720</span><br><span class="line">camera-fps-n=30</span><br><span class="line">camera-fps-d=1</span><br><span class="line">camera-csi-sensor-id=0</span><br></pre></td></tr></table></figure>

<h4 id="videofile"><a href="#videofile" class="headerlink" title="videofile"></a>videofile</h4><p>4个相同文件，用MultiURI</p>
<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br></pre></td><td class="code"><pre><span class="line">[source0]</span><br><span class="line">enable=1</span><br><span class="line">#Type - 1=CameraV4L2 2=URI 3=MultiURI 4=RTSP</span><br><span class="line">type=3</span><br><span class="line">uri=file://../../streams/sample_1080p_h264.mp4</span><br><span class="line">num-sources=4</span><br><span class="line">#drop-frame-interval=2</span><br><span class="line">gpu-id=0</span><br><span class="line"># (0): memtype_device   - Memory type Device</span><br><span class="line"># (1): memtype_pinned   - Memory type Host Pinned</span><br><span class="line"># (2): memtype_unified  - Memory type Unified</span><br><span class="line">cudadec-memtype=0</span><br></pre></td></tr></table></figure>

<h4 id="media-stream"><a href="#media-stream" class="headerlink" title="media stream"></a>media stream</h4><figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br></pre></td><td class="code"><pre><span class="line">[source0]</span><br><span class="line">enable=1</span><br><span class="line">#Type - 1=CameraV4L2 2=URI 3=MultiURI 4=RTSP</span><br><span class="line">type=4</span><br><span class="line">uri=rtsp://admin:admin123@192.168.1.106:554/cam/realmonitor?channel=1&amp;subtype=0</span><br><span class="line">num-sources=1</span><br><span class="line">#drop-frame-interval=2</span><br><span class="line">gpu-id=0</span><br><span class="line"># (0): memtype_device   - Memory type Device</span><br><span class="line"># (1): memtype_pinned   - Memory type Host Pinned</span><br><span class="line"># (2): memtype_unified  - Memory type Unified</span><br><span class="line">cudadec-memtype=0</span><br></pre></td></tr></table></figure>

<h4 id="多路USB"><a href="#多路USB" class="headerlink" title="多路USB"></a>多路USB</h4><figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br></pre></td><td class="code"><pre><span class="line">[source0]</span><br><span class="line">enable=1</span><br><span class="line">#Type - 1=CameraV4L2 2=URI 3=MultiURI 4=RTSP</span><br><span class="line">type=3</span><br><span class="line">uri=file://../../streams/sample_1080p_h264.mp4</span><br><span class="line">num-sources=4</span><br><span class="line">#drop-frame-interval=2</span><br><span class="line">gpu-id=0</span><br><span class="line"># (0): memtype_device   - Memory type Device</span><br><span class="line"># (1): memtype_pinned   - Memory type Host Pinned</span><br><span class="line"># (2): memtype_unified  - Memory type Unified</span><br><span class="line">cudadec-memtype=0</span><br></pre></td></tr></table></figure>

<h4 id="多路CSI"><a href="#多路CSI" class="headerlink" title="多路CSI"></a>多路CSI</h4><figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br></pre></td><td class="code"><pre><span class="line">[source0]</span><br><span class="line">enable=1</span><br><span class="line">#Type - 1=CameraV4L2 2=URI 3=MultiURI 4=RTSP 5=CSI</span><br><span class="line">type=5</span><br><span class="line">camera-csi-sensor-id=0</span><br><span class="line">camera-width=1280</span><br><span class="line">camera-height=720</span><br><span class="line">camera-fps-n=30</span><br><span class="line">camera-fps-d=1</span><br><span class="line"></span><br><span class="line">[source1]</span><br><span class="line">enable=1</span><br><span class="line">#Type - 1=CameraV4L2 2=URI 3=MultiURI 4=RTSP 5=CSI</span><br><span class="line">type=5</span><br><span class="line">camera-csi-sensor-id=1</span><br><span class="line">camera-width=1280</span><br><span class="line">camera-height=720</span><br><span class="line">camera-fps-n=30</span><br><span class="line">camera-fps-d=1</span><br><span class="line"></span><br><span class="line">[source2]</span><br><span class="line">enable=1</span><br><span class="line">#Type - 1=CameraV4L2 2=URI 3=MultiURI 4=RTSP 5=CSI</span><br><span class="line">type=5</span><br><span class="line">camera-csi-sensor-id=2</span><br><span class="line">camera-width=1280</span><br><span class="line">camera-height=720</span><br><span class="line">camera-fps-n=30</span><br><span class="line">camera-fps-d=1</span><br><span class="line"></span><br><span class="line">[source3]</span><br><span class="line">enable=1</span><br><span class="line">#Type - 1=CameraV4L2 2=URI 3=MultiURI 4=RTSP 5=CSI</span><br><span class="line">type=5</span><br><span class="line">camera-csi-sensor-id=3</span><br><span class="line">camera-width=1280</span><br><span class="line">camera-height=720</span><br><span class="line">camera-fps-n=30</span><br><span class="line">camera-fps-d=1</span><br></pre></td></tr></table></figure>



<h2 id="视频处理"><a href="#视频处理" class="headerlink" title="视频处理"></a>视频处理</h2><h4 id="物体检测"><a href="#物体检测" class="headerlink" title="物体检测"></a>物体检测</h4><figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br></pre></td><td class="code"><pre><span class="line"># config-file property is mandatory for any gie section.</span><br><span class="line"># Other properties are optional and if set will override the properties set in</span><br><span class="line"># the infer config file.</span><br><span class="line">[primary-gie]</span><br><span class="line">enable=1</span><br><span class="line">model-engine-file=../../models/Primary_Detector/resnet10.caffemodel_b30_int8.engine</span><br><span class="line">#Required to display the PGIE labels, should be added even when using config-file</span><br><span class="line">#property</span><br><span class="line">batch-size=4</span><br><span class="line">#Required by the app for OSD, not a plugin property</span><br><span class="line">bbox-border-color0=1;0;0;1</span><br><span class="line">bbox-border-color1=0;1;1;1</span><br><span class="line">bbox-border-color2=0;0;1;1</span><br><span class="line">bbox-border-color3=0;1;0;1</span><br><span class="line">interval=0</span><br><span class="line">#Required by the app for SGIE, when used along with config-file property</span><br><span class="line">gie-unique-id=1</span><br><span class="line">config-file=config_infer_primary.txt</span><br></pre></td></tr></table></figure>

<h4 id="物体跟踪"><a href="#物体跟踪" class="headerlink" title="物体跟踪"></a>物体跟踪</h4><figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br></pre></td><td class="code"><pre><span class="line">[tracker]</span><br><span class="line">enable=1</span><br><span class="line">tracker-width=640</span><br><span class="line">tracker-height=368</span><br><span class="line">#tracker-width=480</span><br><span class="line">#tracker-height=272</span><br><span class="line"></span><br><span class="line">#ll-lib-file=/opt/nvidia/deepstream/deepstream-4.0/lib/libnvds_mot_iou.so</span><br><span class="line">#ll-lib-file=/opt/nvidia/deepstream/deepstream-4.0/lib/libnvds_nvdcf.so</span><br><span class="line">ll-lib-file=/opt/nvidia/deepstream/deepstream-4.0/lib/libnvds_mot_klt.so</span><br><span class="line">#ll-config-file required for DCF/IOU only</span><br><span class="line">#ll-config-file=tracker_config.yml</span><br><span class="line">#ll-config-file=iou_config.txt</span><br><span class="line">gpu-id=0</span><br><span class="line">#enable-batch-process applicable to DCF only</span><br><span class="line">enable-batch-process=1</span><br></pre></td></tr></table></figure>

<h4 id="检测后的具体分类"><a href="#检测后的具体分类" class="headerlink" title="检测后的具体分类"></a>检测后的具体分类</h4><figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br></pre></td><td class="code"><pre><span class="line">[secondary-gie0]</span><br><span class="line">enable=1</span><br><span class="line">model-engine-file=../../models/Secondary_VehicleTypes/resnet18.caffemodel_b16_int8.engine</span><br><span class="line">gpu-id=0</span><br><span class="line">batch-size=16</span><br><span class="line">gie-unique-id=4</span><br><span class="line">operate-on-gie-id=1</span><br><span class="line">operate-on-class-ids=0;</span><br><span class="line">config-file=config_infer_secondary_vehicletypes.txt</span><br><span class="line"></span><br><span class="line">[secondary-gie1]</span><br><span class="line">enable=1</span><br><span class="line">model-engine-file=../../models/Secondary_CarColor/resnet18.caffemodel_b16_int8.engine</span><br><span class="line">batch-size=16</span><br><span class="line">gpu-id=0</span><br><span class="line">gie-unique-id=5</span><br><span class="line">operate-on-gie-id=1</span><br><span class="line">operate-on-class-ids=0;</span><br><span class="line">config-file=config_infer_secondary_carcolor.txt</span><br><span class="line"></span><br><span class="line">[secondary-gie2]</span><br><span class="line">enable=1</span><br><span class="line">model-engine-file=../../models/Secondary_CarMake/resnet18.caffemodel_b16_int8.engine</span><br><span class="line">batch-size=16</span><br><span class="line">gpu-id=0</span><br><span class="line">gie-unique-id=6</span><br><span class="line">operate-on-gie-id=1</span><br><span class="line">operate-on-class-ids=0;</span><br><span class="line">config-file=config_infer_secondary_carmake.txt</span><br></pre></td></tr></table></figure>



<h2 id="视频输出"><a href="#视频输出" class="headerlink" title="视频输出"></a>视频输出</h2><h4 id="多路合并"><a href="#多路合并" class="headerlink" title="多路合并"></a>多路合并</h4><p>单路</p>
<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br></pre></td><td class="code"><pre><span class="line">[tiled-display]</span><br><span class="line">enable=1</span><br><span class="line">rows=1</span><br><span class="line">columns=1</span><br><span class="line">width=1280</span><br><span class="line">height=720</span><br></pre></td></tr></table></figure>

<p>多路</p>
<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br></pre></td><td class="code"><pre><span class="line">[tiled-display]</span><br><span class="line">enable=1</span><br><span class="line">rows=4</span><br><span class="line">columns=2</span><br><span class="line">width=1280</span><br><span class="line">height=720</span><br><span class="line">gpu-id=0</span><br><span class="line">#(0): nvbuf-mem-default - Default memory allocated, specific to particular platform</span><br><span class="line">#(1): nvbuf-mem-cuda-pinned - Allocate Pinned/Host cuda memory, applicable for Tesla</span><br><span class="line">#(2): nvbuf-mem-cuda-device - Allocate Device cuda memory, applicable for Tesla</span><br><span class="line">#(3): nvbuf-mem-cuda-unified - Allocate Unified cuda memory, applicable for Tesla</span><br><span class="line">#(4): nvbuf-mem-surface-array - Allocate Surface Array memory, applicable for Jetson</span><br><span class="line">nvbuf-memory-type=0</span><br></pre></td></tr></table></figure>

<h4 id="screen"><a href="#screen" class="headerlink" title="screen"></a>screen</h4><figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br></pre></td><td class="code"><pre><span class="line">[sink0]</span><br><span class="line">enable=1</span><br><span class="line">#Type - 1=FakeSink 2=EglSink 3=File 4=RTSPStreaming 5=Overlay</span><br><span class="line">type=5</span><br><span class="line">sync=0</span><br><span class="line">display-id=0</span><br><span class="line">offset-x=0</span><br><span class="line">offset-y=0</span><br><span class="line">width=0</span><br><span class="line">height=0</span><br><span class="line">overlay-id=1</span><br><span class="line">source-id=0</span><br></pre></td></tr></table></figure>

<h4 id="videofile-1"><a href="#videofile-1" class="headerlink" title="videofile"></a>videofile</h4><figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br></pre></td><td class="code"><pre><span class="line">[sink1]</span><br><span class="line">enable=1</span><br><span class="line">type=3</span><br><span class="line">#1=mp4 2=mkv</span><br><span class="line">container=1</span><br><span class="line">#1=h264 2=h265 3=mpeg4</span><br><span class="line">codec=1</span><br><span class="line">sync=0</span><br><span class="line">bitrate=2000000</span><br><span class="line">output-file=out.mp4</span><br><span class="line">source-id=0</span><br></pre></td></tr></table></figure>

<h4 id="media-stream-1"><a href="#media-stream-1" class="headerlink" title="media stream"></a>media stream</h4><figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br></pre></td><td class="code"><pre><span class="line">[sink2]</span><br><span class="line">enable=1</span><br><span class="line">#Type - 1=FakeSink 2=EglSink 3=File 4=RTSPStreaming 5=Overlay</span><br><span class="line">type=4</span><br><span class="line">#1=h264 2=h265</span><br><span class="line">codec=1</span><br><span class="line">sync=0</span><br><span class="line">bitrate=4000000</span><br><span class="line"># set below properties in case of RTSPStreaming</span><br><span class="line">rtsp-port=8554</span><br><span class="line">udp-port=5400</span><br></pre></td></tr></table></figure>

<p>vlc打开网络流 rtsp:&#x2F;&#x2F;192.168.0.118:8554&#x2F;ds-test</p>
<h4 id="osd"><a href="#osd" class="headerlink" title="osd"></a>osd</h4><figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br></pre></td><td class="code"><pre><span class="line">[osd]</span><br><span class="line">enable=1</span><br><span class="line">border-width=2</span><br><span class="line">text-size=15</span><br><span class="line">text-color=1;1;1;1;</span><br><span class="line">text-bg-color=0.3;0.3;0.3;1</span><br><span class="line">font=Serif</span><br><span class="line">show-clock=0</span><br><span class="line">clock-x-offset=800</span><br><span class="line">clock-y-offset=820</span><br><span class="line">clock-text-size=12</span><br><span class="line">clock-color=1;0;0;0</span><br></pre></td></tr></table></figure>

<h4 id="streammux"><a href="#streammux" class="headerlink" title="streammux"></a>streammux</h4><figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br></pre></td><td class="code"><pre><span class="line">[streammux]</span><br><span class="line">##Boolean property to inform muxer that sources are live</span><br><span class="line">live-source=1</span><br><span class="line">## 根据路数进行设置</span><br><span class="line">batch-size=4</span><br><span class="line">##time out in usec, to wait after the first buffer is available</span><br><span class="line">##to push the batch even if the complete batch is not formed</span><br><span class="line">batched-push-timeout=40000</span><br><span class="line">## Set muxer output width and height</span><br><span class="line">width=1280</span><br><span class="line">height=720</span><br></pre></td></tr></table></figure>



<h2 id="Sample例程"><a href="#Sample例程" class="headerlink" title="Sample例程"></a>Sample例程</h2><ul>
<li>DeepStream Sample App &#x2F;sources&#x2F;apps&#x2F;sample_apps&#x2F;deepstream-app</li>
</ul>
<blockquote>
<p>说明:端到端示例演示了4级联神经网络(1个一级检测器和3个二级分类器)的多相机流，并显示平铺输出。</p>
</blockquote>
<ul>
<li><p>DeepStream Test 1 &#x2F;sources&#x2F;apps&#x2F;sample_apps&#x2F;deepstream-t</p>
</li>
<li><p>DeepStream Test 2 &#x2F;sources&#x2F;apps&#x2F;sample_apps&#x2F;deepstream-test2</p>
</li>
</ul>
<blockquote>
<p>说明:简单的应用程序，建立在test1之上，显示额外的属性，如跟踪和二级分类属性。</p>
</blockquote>
<ul>
<li>DeepStream Test 3 &#x2F;sources&#x2F;apps&#x2F;sample_apps&#x2F;deepstream-test3</li>
</ul>
<blockquote>
<p>说明:简单的应用程序，建立在test1的基础上，显示多个输入源和批处理使用nvstreammuxer。</p>
</blockquote>
<ul>
<li>DeepStream Test 4 &#x2F;sources&#x2F;apps&#x2F;sample_apps&#x2F;deepstream-test4</li>
</ul>
<blockquote>
<p>说明:这是在Test1示例的基础上构建的，演示了“nvmsgconv”和“nvmsgbroker”插件在物联网连接管道中的使用。对于test4，用户必须修改kafka代理连接字符串才能成功连接。需要安装分析服务器docker之前运行test4。DeepStream分析文档有关于设置分析服务器的更多信息。</p>
</blockquote>
<ul>
<li>FasterRCNN Object Detector &#x2F;sources&#x2F;objectDetector_FasterRCNN</li>
</ul>
<blockquote>
<p>说明:FasterRCNN物体探测器实例。</p>
</blockquote>
<ul>
<li>SSD Object Detector &#x2F;sources&#x2F;objectDetector_SSD</li>
</ul>
<blockquote>
<p>说明:SSD目标探测器实例。</p>
</blockquote>
<h1 id="部署自己的模型"><a href="#部署自己的模型" class="headerlink" title="部署自己的模型"></a>部署自己的模型</h1><p><a target="_blank" rel="noopener" href="https://blog.csdn.net/ailaier/article/details/116270962">Jetson nano上部署自己的Yolov5模型（TensorRT加速）_ailaier的专栏-CSDN博客_jetson nano yolov5</a></p>
<h1 id="References"><a href="#References" class="headerlink" title="References"></a>References</h1><h2 id="部署"><a href="#部署" class="headerlink" title="部署"></a>部署</h2><ul>
<li><p><a target="_blank" rel="noopener" href="https://docs.nvidia.com/metropolis/deepstream/dev-guide/text/DS_custom_YOLO.html">Custom YOLO Model in the DeepStream YOLO App — DeepStream 6.0 Release documentation (nvidia.com)</a></p>
</li>
<li><p><a target="_blank" rel="noopener" href="https://blog.csdn.net/sshheennddee123/article/details/121060158">Jetson nano部署过程记录：yolov5s+TensorRT+Deepstream检测usb摄像头_sshheennddee123的博客-CSDN博客</a></p>
</li>
<li><p><a target="_blank" rel="noopener" href="https://www.bilibili.com/read/cv11869887">Jetson nano从烧录系统到DeepStream+TensorRT+yolov5检测CSI摄像头视频 - 哔哩哔哩 (bilibili.com)</a></p>
</li>
<li><p><a target="_blank" rel="noopener" href="https://blog.csdn.net/ailaier/article/details/116270962">Jetson nano上部署自己的Yolov5模型（TensorRT加速）_ailaier的专栏-CSDN博客_jetson nano yolov5</a></p>
</li>
<li><p><a target="_blank" rel="noopener" href="https://github.com/rscgg37248/DeepStream6.0_Yolov5-6.0">rscgg37248&#x2F;DeepStream6.0_Yolov5-6.0: 基于DeepStream6.0和yolov5-6.0的目标检测 (github.com)</a></p>
</li>
<li><p><a target="_blank" rel="noopener" href="https://zhuanlan.zhihu.com/p/391513840">NVIDIA Jetson Nano 2GB 系列文章（30）：DeepStream 摄像头“实时性能” - 知乎 (zhihu.com)</a></p>
</li>
<li><p><a target="_blank" rel="noopener" href="https://blog.csdn.net/ailaier/article/details/116270962"> Jetson nano上部署自己的Yolov5模型（TensorRT加速）_ailaier的专栏-CSDN博客_jetson nano yolov5</a></p>
</li>
</ul>
<h2 id="deepstream"><a href="#deepstream" class="headerlink" title="deepstream"></a>deepstream</h2><ul>
<li><p><a target="_blank" rel="noopener" href="https://docs.nvidia.com/metropolis/deepstream/4.0/dev-guide/index.html#page/DeepStream_Development_Guide%2Fdeepstream_app_config.3.2.html%23wwpID0E0WB0HA">DeepStream Development Guide (nvidia.com)</a></p>
</li>
<li><p><a target="_blank" rel="noopener" href="http://openjetson.com/index.php/2020/12/21/deepstream/">Deepstream使用 – OpenJetson</a></p>
</li>
<li><p><a target="_blank" rel="noopener" href="https://cloud.tencent.com/developer/article/1524712">关于NVIDIA Deepstream SDK压箱底的资料都在这里了 - 云+社区 - 腾讯云 (tencent.com)</a></p>
</li>
</ul>

      
    </div>
    <div class="article-footer">
      <blockquote class="mt-2x">
  <ul class="post-copyright list-unstyled">
    
    <li class="post-copyright-link hidden-xs">
      <strong>本文链接：</strong>
      <a href="https://gitee.com/yin-qiyu/myblog/2022/02/23/learn_jetson/2.%20yolov5+tensorrt+deepstream/" title="yolov5+trt+deepstream" target="_blank" rel="external">https://gitee.com/yin-qiyu/myblog/2022/02/23/learn_jetson/2. yolov5+tensorrt+deepstream/</a>
    </li>
    
    <li class="post-copyright-license">
      <strong>版权声明： </strong> 本博客所有文章除特别声明外，均采用 <a href="http://creativecommons.org/licenses/by/4.0/deed.zh" target="_blank" rel="external">CC BY 4.0 CN协议</a> 许可协议。转载请注明出处！
    </li>
  </ul>
</blockquote>


<div class="panel panel-default panel-badger">
  <div class="panel-body">
    <figure class="media">
      <div class="media-left">
        <a href="https://github.com/cofess" target="_blank" class="img-burn thumb-sm visible-lg">
          <img src="/yin-qiyu/myblog/images/avatar.jpg" class="img-rounded w-full" alt="">
        </a>
      </div>
      <div class="media-body">
        <h3 class="media-heading"><a href="https://github.com/cofess" target="_blank"><span class="text-dark">昵称</span><small class="ml-1x">Web Developer &amp; Designer</small></a></h3>
        <div>个人简介。</div>
      </div>
    </figure>
  </div>
</div>


    </div>
  </article>
  
    
  <section id="comments">
  	
      <div id="vcomments"></div>
    
  </section>


  
</div>

  <nav class="bar bar-footer clearfix" data-stick-bottom>
  <div class="bar-inner">
  
  <ul class="pager pull-left">
    
    <li class="prev">
      <a href="/yin-qiyu/myblog/2022/02/24/learn_jetson/3.%E5%8F%A3%E7%BD%A9%E6%A3%80%E6%B5%8Bdemo/" title="(no title)"><i class="icon icon-angle-left" aria-hidden="true"></i><span>&nbsp;&nbsp;Newer</span></a>
    </li>
    
    
    <li class="next">
      <a href="/yin-qiyu/myblog/2022/02/20/learn_jetson/issues/" title="(no title)"><span>Older&nbsp;&nbsp;</span><i class="icon icon-angle-right" aria-hidden="true"></i></a>
    </li>
    
    
  </ul>
  
  
  <!-- Button trigger modal -->
  <button type="button" class="btn btn-fancy btn-donate pop-onhover bg-gradient-warning" data-toggle="modal" data-target="#donateModal"><span>$</span></button>
  <!-- <div class="wave-icon wave-icon-danger btn-donate" data-toggle="modal" data-target="#donateModal">
    <div class="wave-circle"><span class="icon"><i class="icon icon-bill"></i></span></div>
  </div> -->
  
  
  <div class="bar-right">
    
    <div class="share-component" data-sites="weibo,qq,wechat,facebook,twitter" data-mobile-sites="weibo,qq,qzone"></div>
    
  </div>
  </div>
</nav>
  
<!-- Modal -->
<div class="modal modal-center modal-small modal-xs-full fade" id="donateModal" tabindex="-1" role="dialog">
  <div class="modal-dialog" role="document">
    <div class="modal-content donate">
      <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
      <div class="modal-body">
        <div class="donate-box">
          <div class="donate-head">
            <p>Maybe you could buy me a cup of coffee.</p>
          </div>
          <div class="tab-content">
            <div role="tabpanel" class="tab-pane fade active in" id="alipay">
              <div class="donate-payimg">
                <img src="/yin-qiyu/myblog/images/donate/alipayimg.png" alt="Scan Qrcode" title="Scan" />
              </div>
              <p class="text-muted mv">Scan this qrcode</p>
              <p class="text-grey">Open alipay app scan this qrcode, buy me a coffee!</p>
            </div>
            <div role="tabpanel" class="tab-pane fade" id="wechatpay">
              <div class="donate-payimg">
                <img src="/yin-qiyu/myblog/images/donate/wechatpayimg.png" alt="Scan Qrcode" title="Scan" />
              </div>
              <p class="text-muted mv">Scan this qrcode</p>
              <p class="text-grey">Open wechat app scan this qrcode, buy me a coffee!</p>
            </div>
          </div>
          <div class="donate-footer">
            <ul class="nav nav-tabs nav-justified" role="tablist">
              <li role="presentation" class="active">
                <a href="#alipay" id="alipay-tab" role="tab" data-toggle="tab" aria-controls="alipay" aria-expanded="true"><i class="icon icon-alipay"></i> alipay</a>
              </li>
              <li role="presentation" class="">
                <a href="#wechatpay" role="tab" id="wechatpay-tab" data-toggle="tab" aria-controls="wechatpay" aria-expanded="false"><i class="icon icon-wepay"></i> wechat payment</a>
              </li>
            </ul>
          </div>
        </div>
      </div>
    </div>
  </div>
</div>



</main>

  <footer class="footer" itemscope itemtype="http://schema.org/WPFooter">
	
	
    <ul class="social-links">
    	
        <li><a href="https://github.com/cofess" target="_blank" title="Github" data-toggle=tooltip data-placement=top><i class="icon icon-github"></i></a></li>
        
        <li><a href="http://weibo.com/cofess" target="_blank" title="Weibo" data-toggle=tooltip data-placement=top><i class="icon icon-weibo"></i></a></li>
        
        <li><a href="https://twitter.com/iwebued" target="_blank" title="Twitter" data-toggle=tooltip data-placement=top><i class="icon icon-twitter"></i></a></li>
        
        <li><a href="https://www.behance.net/cofess" target="_blank" title="Behance" data-toggle=tooltip data-placement=top><i class="icon icon-behance"></i></a></li>
        
        <li><a href="/yin-qiyu/myblog/atom.xml" target="_blank" title="Rss" data-toggle=tooltip data-placement=top><i class="icon icon-rss"></i></a></li>
        
    </ul>

    <div class="copyright">
    	
        <div class="publishby">
        	Theme by <a href="https://github.com/cofess" target="_blank"> cofess </a>base on <a href="https://github.com/cofess/hexo-theme-pure" target="_blank">pure</a>.
        </div>
    </div>
</footer>
  <script src="//cdn.jsdelivr.net/npm/jquery@1.12.4/dist/jquery.min.js"></script>
<script>
window.jQuery || document.write('<script src="js/jquery.min.js"><\/script>')
</script>

<script src="/yin-qiyu/myblog/js/plugin.min.js"></script>


<script src="/yin-qiyu/myblog/js/application.js"></script>


    <script>
(function (window) {
    var INSIGHT_CONFIG = {
        TRANSLATION: {
            POSTS: 'Posts',
            PAGES: 'Pages',
            CATEGORIES: 'Categories',
            TAGS: 'Tags',
            UNTITLED: '(Untitled)',
        },
        ROOT_URL: '/yin-qiyu/myblog/',
        CONTENT_URL: '/yin-qiyu/myblog/content.json',
    };
    window.INSIGHT_CONFIG = INSIGHT_CONFIG;
})(window);
</script>

<script src="/yin-qiyu/myblog/js/insight.js"></script>






   




   
    
  <script src="//cdn1.lncld.net/static/js/3.0.4/av-min.js"></script>
  <script src="//cdn.jsdelivr.net/npm/valine"></script>
  <script type="text/javascript">
  var GUEST = ['nick', 'mail', 'link'];
  var meta = 'nick,mail,link';
  meta = meta.split(',').filter(function(item) {
    return GUEST.indexOf(item) > -1;
  });
  new Valine({
    el: '#vcomments',
    verify: false,
    notify: false,
    appId: '',
    appKey: '',
    placeholder: 'Just go go',
    avatar: 'mm',
    meta: meta,
    pageSize: '10' || 10,
    visitor: false
  });
  </script>

     







</body>
</html>